# encoding=utf-8
import sys
from  time import sleep
from Configure import Attribute
reload(sys)
sys.setdefaultencoding('utf-8')
def publicDynamicForVideo(dr):
    '''动态---拍视频'''
    dr.find_element_by_id(Attribute.pubdynamic_addVideoButton_id).click()
    dr.find_element_by_id(Attribute.pubdynamic_addVideo_aliyunRecordBtn_id).click()
    '''录制30S的视频等待自己结束，因为无法定位暂停按钮'''
    sleep(40)

def publicDynamicForPhoto(dr):
    '''动态---选择照片'''
    dr.find_element_by_id(Attribute.pubdynamic_addPotoButton_id).click()
    currentPhotos = dr.find_elements_by_id(Attribute.pubdynamic_addPotoButton_phonePhotoCheck_id)
    photoCount=0
    #最多选择本地八张照片
    for photo in currentPhotos:
        if photoCount<8:
            photo.click()
            photoCount+=1
        else:
            break
    dr.find_element_by_id(Attribute.pubdynamic_addPotoButton_openCamera_id).click()
    dr.find_element_by_id(Attribute.pubdynamic_addPotoButton_takePhoto_id).click()
    dr.find_element_by_id(Attribute.pubdynamic_addPotoButton_imgYes_id).click()
    dr.find_element_by_id(Attribute.pubdynamic_addPotoButton_pictureTvOk_id).click()
